var withdrawalCount = 0;
var pageSize = 10;
function withdrawalList(page, UserName, WithdrawalStatus, StartTime, EndTime) {
    $.ajax({
        url: "/PersonalCenter/GetWithdrawalList",
        type: "post",
        data: { page: page, rows: pageSize, UserName: UserName, WithdrawalStatus: WithdrawalStatus, StartTime: StartTime, EndTime: EndTime },
        dataType: "json",
        async: false,
        success: function (list) {
            withdrawalCount = list.total;
			//alert( withdrawalCount);
            $('#dg_WithdrawalList').html("<tr><th>流水号</th><th>银行帐号</th><th>提现金币</th><th>到账金额</th><th>提现状态</th></tr>")
            if (list.total > 0) {
                $.each(list.rows, function (i, n) {
                    $('#dg_WithdrawalList').append("<tr><td>" + n["order"] + "</td>" +
                    "<td>" + n["banknum"] + "</td>" +
                    "<td>" + n["gamemoney"] + "</td>" +
                    "<td>" + n["realmoney"] + "</td>" +
                    "<td>" + wStatus(n["wstatus"]) + "</td></tr>");
                });
            }
            else {
                $('#dg_WithdrawalList').append("<tr><td colspan=\"6\">暂时没有数据...</td></tr>");
            }
        }
    });
}

withdrawalList(1,  "", 0, "", "");

//分页
$("#withdrawalPage").createPage({
    pageCount: withdrawalCount,
    pageSize: pageSize,
    current: 1,
    backFn: function (p) {
       // withdrawalList(p,  $("#UserName").val(), $("#WithdrawalStatus").val(), $('#StartTime').datebox('getValue'), $('#EndTime').datebox('getValue'));
	   withdrawalList(p,  "", 0, "", "");
    }
});

$("#btnWDSearch").click(function () {
    withdrawalList(1,  $("#UserName").val(), $("#WithdrawalStatus").val(), $('#StartTime').datebox('getValue'), $('#EndTime').datebox('getValue'));
});

function wStatus(type) {
    var res = "";
    switch (type) {
        case '0': res = "正在审核中"; break;
        case '1': res = "提现成功"; break;
        case '2': res = "提现失败"; break;
        case '3': res = "余额返还"; break;
    }
    return res;
}